package com.example.demo.controller;

import com.example.demo.entity.Dept;
import com.example.demo.service.impl.DeptServiceImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by baidou on 2020/8/26.
 */
@RequestMapping("/dept")
@RestController
public class DeptController {
    @Autowired
    private DeptServiceImp deptService;

    @ResponseBody
    @GetMapping("/selectByPrimaryKey")
    public Dept selectByPrimaryKey(Integer deptno) {
        Dept dept = deptService.selectByPrimaryKey(deptno);
        return dept;
    }


    @ResponseBody
    @GetMapping("/selectAll")
    public List<Dept> selectAll(){
        List depts = deptService.selectAll();
        return depts;
    }
}
